core: diff: Correctly handle files changing type
authorColin Walters <walters@verbum.org>
Thu, 17 Nov 2011 04:09:32 +0000 (23:09 -0500)
committerColin Walters <walters@verbum.org>
Thu, 17 Nov 2011 04:09:32 +0000 (23:09 -0500)
src/libostree/ostree-repo.c
tests/t0000-basic.sh

index f23f0dad0d83e6b2c88fe64ef58de3192a5d6f28..fca253b1ea77a9337cf310fe396490584630db88 100644 (file)
@@ -2072,7 +2072,10 @@ diff_dirs (GFile          *a,
           child_b_type = g_file_info_get_file_type (child_b_info);
           if (child_a_type != child_b_type)
             {
-              g_ptr_array_add (modified, g_object_ref (child_a));
+              OstreeRepoDiffItem *diff_item = diff_item_new (child_a, child_a_info,
+                                                             child_b, child_b_info, NULL, NULL);
+              
+              g_ptr_array_add (modified, diff_item);
             }
           else
             {
index 1e5c84a6868506936f30a196e104eb01e785bd46..1485acc2951aad616a6c185e779f05c9e381febb 100755 (executable)
@@ -19,7 +19,7 @@
 
 set -e
 
-echo "1..14"
+echo "1..15"
 
 . libtest.sh
 
@@ -110,6 +110,15 @@ cd ${test_tmpdir}
 assert_file_has_content diff-test2-2 'A */oh-look-a-file$'
 echo "ok diff cwd"
 
+cd ${test_tmpdir}/checkout-test2-4
+rm four
+mkdir four
+touch four/other
+$OSTREE diff test2 ./ > ${test_tmpdir}/diff-test2-2
+cd ${test_tmpdir}
+assert_file_has_content diff-test2-2 'M */four$'
+echo "ok diff file changing type"
+
 cd ${test_tmpdir}/checkout-test2-4
 echo afile > oh-look-a-file
 cat > ${test_tmpdir}/ostree-commit-metadata <<EOF